package com.ricchieri.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.springframework.cache.annotation.Cacheable;

import com.ricchieri.dao.interf.IEmailTypeDao;
import com.ricchieri.filter.BasicFilter;
import com.ricchieri.model.EmailType;

public class EmailTypeDao extends GenericDao implements IEmailTypeDao {

	private static final long serialVersionUID = -7886512368572725074L;

	@Override
	@Cacheable(value="emailType")
	@SuppressWarnings("unchecked")
	public List<EmailType> getAllEmailTypes(BasicFilter filter) {
		Criteria criteria = criteriaAllEmailType(filter);
		
		return criteria.list();
	}
	
	private Criteria criteriaAllEmailType(BasicFilter filter) {
		return super.criteriaAllBasic(filter, EmailType.class);
	}	
	
	@Override
	protected String getTableName() {
		return "emailType";
	}
}
